package com.revelvy.pojo;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.revelvy.utils.RegexProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;


/**
 * Author: Revelvy
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Validated
public class Users {
    private Integer id;
    private Integer rid;
    @NotBlank(message = "用户名不允许为空")
    @Length(min = 3, max = 10, message = "用户名长度必须在{min}~{max}个字符之间")
    private String username;
    @NotBlank(message = "密码不允许为空")
    @Length(min = 6, max = 15, message = "密码长度必须在{min}~{max}个字符之间")
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;
    @Email(regexp = RegexProperties.EMAIL_PATTERN, message = "邮箱格式不正确")
    private String email;
    @Size(min = 11, max = 11, message = "手机号码长度不正确")
    @Pattern(regexp = RegexProperties.MOBILE_PATTERN, message = "手机号码格式不正确")
    private String mobile;
    private Boolean mg_state;
    private String create_time;
    private String role_name;
}
